package de.ludo.gaming;

public class LudoPositionSupport {
	/**
	 * The following methods are neccessary to create the logic
	 */

	// Fields for the yellow player
	public int getYellowHouseOne() {
		return 45;
	}

	public int getYellowHouseTwo() {
		return 46;
	}

	public int getYellowHouseThree() {
		return 47;
	}

	public int getYellowHouseFour() {
		return 48;
	}

	public int getYellowStart() {
		return 1;
	}

	public int getFieldBeforeFinishForYellow() {
		return 40;
	}

	public int getYellowFinishOne() {
		return 41;
	}

	public int getYellowFinishTwo() {
		return 42;
	}

	public int getYellowFinishThree() {
		return 43;
	}

	public int getYellowFinishFour() {
		return 44;
	}

	// Fields for the green player
	public int getGreenHouseOne() {
		return 53;
	}

	public int getGreenHouseTwo() {
		return 54;
	}

	public int getGreenHouseThree() {
		return 55;
	}

	public int getGreenHouseFour() {
		return 56;
	}

	public int getGreenStart() {
		return 11;
	}

	public int getFieldBeforeFinishForGreen() {
		return 10;
	}

	public int getGreenFinishOne() {
		return 49;
	}

	public int getGreenFinishTwo() {
		return 50;
	}

	public int getGreenFinishThree() {
		return 51;
	}

	public int getGreenFinishFour() {
		return 52;
	}

	// Fields for the red player
	public int getRedHouseOne() {
		return 61;
	}

	public int getRedHouseTwo() {
		return 62;
	}

	public int getRedHouseThree() {
		return 63;
	}

	public int getRedHouseFour() {
		return 64;
	}

	public int getRedStart() {
		return 21;
	}

	public int getFieldBeforeFinishForRed() {
		return 20;
	}

	public int getRedFinishOne() {
		return 57;
	}

	public int getRedFinishTwo() {
		return 58;
	}

	public int getRedFinishThree() {
		return 59;
	}

	public int getRedFinishFour() {
		return 60;
	}

	// Fields for the blue player
	public int getBlueHouseOne() {
		return 69;
	}

	public int getBlueHouseTwo() {
		return 70;
	}

	public int getBlueHouseThree() {
		return 71;
	}

	public int getBlueHouseFour() {
		return 72;
	}

	public int getBlueStart() {
		return 31;
	}

	public int getFieldBeforeFinishForBlue() {
		return 30;
	}

	public int getBlueFinishOne() {
		return 65;
	}

	public int getBlueFinishTwo() {
		return 66;
	}

	public int getBlueFinishThree() {
		return 67;
	}

	public int getBlueFinishFour() {
		return 68;
	}

	/**
	 * Return Start Positions from the Players
	 * 
	 * @param typ
	 * @return 0 is wrong
	 */
	public int getStartPos(PlayerType typ) {
		if (PlayerType.PLAYER_YELLOW.ordinal() == typ.ordinal()) {
			return getYellowStart();
		} else if (PlayerType.PLAYER_RED.ordinal() == typ.ordinal()) {
			return getRedStart();
		} else if (PlayerType.PLAYER_GREEN.ordinal() == typ.ordinal()) {
			return getGreenStart();
		} else if (PlayerType.PLAYER_BLUE.ordinal() == typ.ordinal()) {
			return getBlueStart();
		} else {
			return 0;
		}
	}

	/**
	 * Return House Positions from the Players
	 * 
	 * @param typ
	 * @return null is wrong
	 */
	public int[] getHousePositions(PlayerType typ) {
		if (PlayerType.PLAYER_YELLOW.equals(typ)) {
			int[] y = { getYellowHouseOne(), getYellowHouseTwo(),
					getYellowHouseThree(), getYellowHouseFour() };
			return y;
		} else if (PlayerType.PLAYER_RED.equals(typ)) {
			int[] r = { getRedHouseOne(), getRedHouseTwo(), getRedHouseThree(),
					getRedHouseFour() };
			return r;
		} else if (PlayerType.PLAYER_GREEN.equals(typ)) {
			int[] g = { getGreenHouseOne(), getGreenHouseTwo(),
					getGreenHouseThree(), getGreenHouseFour() };
			return g;
		} else if (PlayerType.PLAYER_BLUE.equals(typ)) {
			int[] b = { getBlueHouseOne(), getBlueHouseTwo(),
					getBlueHouseThree(), getBlueHouseFour() };
			return b;
		} else {
			return null;
		}
	}

	/**
	 * Returns the finish positions for the current player
	 * 
	 * @param p
	 * @return int[] with the finish positions for the current player
	 */
	public int[] getFinishPositions(PlayerType p) {
		if (PlayerType.PLAYER_BLUE.equals(p)) {
			int[] helper = { getBlueFinishOne(), getBlueFinishTwo(),
					getBlueFinishThree(), getBlueFinishFour() };
			return helper;
		} else if (PlayerType.PLAYER_GREEN.equals(p)) {
			int[] helper = { getGreenFinishOne(), getGreenFinishTwo(),
					getGreenFinishThree(), getGreenFinishFour() };
			return helper;
		} else if (PlayerType.PLAYER_RED.equals(p)) {
			int[] helper = { getRedFinishOne(), getRedFinishTwo(),
					getRedFinishThree(), getRedFinishFour() };
			return helper;
		} else if (PlayerType.PLAYER_YELLOW.equals(p)) {
			int[] helper = { getYellowFinishOne(), getYellowFinishTwo(),
					getYellowFinishThree(), getYellowFinishFour() };
			return helper;
		} else {
			return null;
		}
	}

	/**
	 * Method to return the defined baseposition for the charactes
	 * 
	 * @param oppHelper
	 * @return int the baseposition in gameboard
	 */
	public int getToBase(int character) {
		if (character == 1) {
			return getYellowHouseOne();
		} else if (character == 2) {
			return getYellowHouseTwo();
		} else if (character == 3) {
			return getYellowHouseThree();
		} else if (character == 4) {
			return getYellowHouseFour();
		} else if (character == 5) {
			return getRedHouseOne();
		} else if (character == 6) {
			return getRedHouseTwo();
		} else if (character == 7) {
			return getRedHouseThree();
		} else if (character == 8) {
			return getRedHouseFour();
		} else if (character == 9) {
			return getGreenHouseOne();
		} else if (character == 10) {
			return getGreenHouseTwo();
		} else if (character == 11) {
			return getGreenHouseThree();
		} else if (character == 12) {
			return getGreenHouseFour();
		} else if (character == 13) {
			return getBlueHouseOne();
		} else if (character == 14) {
			return getBlueHouseTwo();
		} else if (character == 15) {
			return getBlueHouseThree();
		} else if (character == 16) {
			return getBlueHouseFour();
		} else {
			return 0;
		}
	}
}
